package windbell.domain.risk.events;

import edu.fudan.langlab.domain.document.IDocument;
import edu.fudan.mylang.pf.event.EntityEventsManager;
import java.util.Collection;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import windbell.domain.risk.RiskReport;
import windbell.domain.risk.events.RiskReportEventsListener;

@Service("windbell.domain.risk.events.RiskReportEventsManager")
public class RiskReportEventsManager extends EntityEventsManager<RiskReport> {
  @Autowired(required = false)
  private Collection<RiskReportEventsListener> listeners = com.google.common.collect.Lists.newArrayList();;
  
  protected Collection<RiskReportEventsListener> getListeners() {
    return listeners;
  }
  
  public void fireFinish(final RiskReport entity) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((RiskReportEventsListener)listener).finish(entity);
    }
    
  }
  
  public void fireUpdate(final RiskReport entity, final Procedure1<? super RiskReport> updater) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((RiskReportEventsListener)listener).update(entity,updater);
    }
    
  }
  
  public void fireCreateDocument(final RiskReport entity, final Procedure1<? super IDocument> init) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((RiskReportEventsListener)listener).createDocument(entity,init);
    }
    
  }
  
  public void fireRemoveDocument(final RiskReport entity, final IDocument document) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((RiskReportEventsListener)listener).removeDocument(entity,document);
    }
    
  }
  
  public void fireReopen(final RiskReport entity) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((RiskReportEventsListener)listener).reopen(entity);
    }
    
  }
}
